import Vue from 'vue'
import VueRouter from 'vue-router'
import Movie from '../views/MovieView.vue';
import Cinema  from '../views/CinemaView.vue';
import User  from '../views/UserView.vue';

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect:'/movie/now'
  },
  {
    path: '/movie',
    name: 'movie',
    component: Movie,
    redirect:'/movie/now',
    children:[
      {path:'city',component:()=>import('@/components/City.vue')},
      {path:'now',component:()=>import('@/components/Now.vue')},
      {path:'coming',component:()=>import('@/components/Coming.vue')},
      {path:'search',component:()=>import('@/components/Search.vue')}
    ]
  },
  {
    path: '/cinema',
    name: 'cinema',
    component: Cinema
  },
  {
    path: '/user',
    name: 'user',
    component: User
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
